package com.tadpole.music.view.activity.question;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.tadpole.music.R;
import com.tadpole.music.adapter.question.KeyKnowledgeAdapter;
import com.tadpole.music.utils.NoDoubleClickListener;
import com.tadpole.music.view.activity.base.BaseActivity;
import com.tadpole.music.view.widget.MyRecyclerViewDivider;

/**
 * 重点知识
 * Created By 孙岩
 * on 2020/9/14
 */
public class KeyKnowledgeActivity extends BaseActivity {
    //回退
    private View view_back_icon;
    //标题
    private TextView actionbar_title;
    //学院
    private TextView tvName;
    //recyclerView
    private RecyclerView recyclerView;
    //adapter
    private KeyKnowledgeAdapter keyKnowledgeAdapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_key_knowleddge);
        initViews();
        initListeners();
    }

    //初始化控件
    private void initViews(){
        view_back_icon = findViewById(R.id.view_back_icon);
        actionbar_title = findViewById(R.id.actionbar_title);
        actionbar_title.setText("重点知识");
        recyclerView = findViewById(R.id.recyclerView);


        LinearLayoutManager layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        recyclerView.setLayoutManager(layoutManager);
        //创建适配器
        keyKnowledgeAdapter = new KeyKnowledgeAdapter(this);
        //给RecyclerView设置适配器
        recyclerView.setAdapter(keyKnowledgeAdapter);
        recyclerView.setNestedScrollingEnabled(false);
        recyclerView.addItemDecoration(new MyRecyclerViewDivider(this
                , LinearLayoutManager.HORIZONTAL, 1, ContextCompat.getColor(this, R.color.color_ee)));
    }

    //初始化监听器
    private void initListeners(){
        view_back_icon.setOnClickListener(new NoDoubleClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                KeyKnowledgeActivity.this.finish();
            }
        });
    }
}
